-- SharedMedia access
local LibSharedMedia 	= LibStub("LibSharedMedia-3.0")
Avion2_PowerMedia 		= {
	loader 				= CreateFrame("Frame", "Avion2_PowerMedia", UIParent)
}
-- Note: This will be garbaged!


-- Injection function
function Avion2_PowerMedia:Inject()
	-- Self who's that?
	local self = Avion2_PowerMedia
	
	-- Not loaded?
	if (not self.textureList or not self.soundList) then 
		return 
	end

	-- Register each texture to Avion2
	for name, file in pairs(self.textureList) do
		Avion2Core:AddTexture(name, "Interface\\AddOns\\Avion2_PowerMedia\\Textures\\" .. file)
	end
	self.textureList = nil

	-- Register each sound to SharedMedia
	for name, file in pairs(self.soundList) do
		LibSharedMedia:Register(LibSharedMedia.MediaType.SOUND, name, "Interface\\AddOns\\Avion2_PowerMedia\\Sounds\\" .. file)
	end
	self.soundList = nil
	
	-- Disable self
	self.loader:SetScript("OnLoad", nil)
	self.loader:SetScript("OnUpdate", nil)
	self.loader:UnregisterEvent("OnUpdate")
	self.loader:UnregisterEvent("OnLoad")
	self.loader:SetParent(nil)
	self.loader:Hide()
	self.loader 		= nil
	self.Inject			= nil
	Avion2_PowerMedia	= nil
	LibSharedMedia 		= nil
end